//
//  ReceivePigInfoView.m
//  PigMarket
//
//  Created by mac on 2019/5/10.
//  Copyright © 2019 felix.pigmarket.oc. All rights reserved.
//

#import "ReceivePigInfoView.h"

@implementation ReceivePigInfoView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self initView];
        [self initLayout];
    }
    return self;
}

- (void)initView {
    [self addSubview:self.headImg];
    [self addSubview:self.pigInfoTitle];
    [self addSubview:self.pigNum];
    [self addSubview:self.pigInfoLine];
    [self addSubview:self.birthdayLab];
    [self addSubview:self.birthdayDetailLab];
    [self addSubview:self.adoptedDateLab];
    [self addSubview:self.adoptedDateDetailLab];
    [self addSubview:self.currentDaysLab];
    [self addSubview:self.currentDaysDetailLab];
    [self addSubview:self.weightLab];
    [self addSubview:self.weightDetailLab];
    [self addSubview:self.dateLab];
    [self addSubview:self.dateDetailLab];
    [self addSubview:self.arrearageMoney];
    [self addSubview:self.arrearageDetailMoney];
    [self addSubview:self.bottomLine];
    [self addSubview:self.transferMoney];
    [self addSubview:self.transferDetailMoney];
}
- (void)initLayout {
    
    [self.headImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.top.mas_equalTo(10);
        make.size.mas_equalTo(CGSizeMake(32, 32));
    }];
    [self.pigInfoTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.headImg.mas_centerY);
        make.left.mas_equalTo(self.headImg.mas_right).offset(10);
        make.height.mas_equalTo(22);
    }];
    [self.pigNum mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.headImg.mas_centerY);
        make.left.mas_equalTo(self.pigInfoTitle.mas_right).offset(3);
        make.height.mas_equalTo(18);
    }];
    [self.pigInfoLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.headImg.mas_bottom).offset(10);
        make.left.mas_equalTo(15);
        make.right.mas_equalTo(-15);
        make.height.mas_equalTo(1);
    }];
    [self.birthdayLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.top.mas_equalTo(self.pigInfoLine.mas_bottom).offset(12);
        make.height.mas_equalTo(18);
    }];
    [self.birthdayDetailLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(16);
        make.centerY.mas_equalTo(self.birthdayLab.mas_centerY);
        make.left.mas_equalTo(100);
    }];
    [self.adoptedDateLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.height.mas_equalTo(16);
        make.top.mas_equalTo(self.birthdayLab.mas_bottom).offset(12);
    }];
    [self.adoptedDateDetailLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(16);
        make.centerY.mas_equalTo(self.adoptedDateLab.mas_centerY);
        make.left.mas_equalTo(100);
    }];
    [self.currentDaysLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.height.mas_equalTo(16);
        make.top.mas_equalTo(self.adoptedDateLab.mas_bottom).offset(12);
    }];
    [self.currentDaysDetailLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(16);
        make.centerY.mas_equalTo(self.currentDaysLab.mas_centerY);
        make.left.mas_equalTo(100);
    }];
    [self.weightLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.top.mas_equalTo(self.currentDaysLab.mas_bottom).offset(12);
        make.height.mas_equalTo(16);
    }];
    [self.weightDetailLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(16);
        make.centerY.mas_equalTo(self.weightLab.mas_centerY);
        make.left.mas_equalTo(100);
    }];
    [self.dateLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.height.mas_equalTo(16);
        make.top.mas_equalTo(self.weightLab.mas_bottom).offset(12);
    }];
    [self.dateDetailLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(16);
        make.centerY.mas_equalTo(self.dateLab.mas_centerY);
        make.left.mas_equalTo(100);
    }];
    
    [self.arrearageMoney mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.height.mas_equalTo(16);
        make.top.mas_equalTo(self.dateDetailLab.mas_bottom).offset(12);
    }];
    [self.arrearageDetailMoney mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(16);
        make.centerY.mas_equalTo(self.arrearageMoney.mas_centerY);
        make.left.mas_equalTo(100);
    }];
    [self.bottomLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.right.mas_equalTo(-15);
        make.top.mas_equalTo(self.arrearageDetailMoney.mas_bottom).offset(10);
        make.height.mas_equalTo(1);
    }];
    [self.transferMoney mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.top.mas_equalTo(self.bottomLine.mas_bottom).offset(13);
        make.height.mas_equalTo(17);
    }];
    [self.transferDetailMoney mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-15);
        make.centerY.mas_equalTo(self.transferMoney.mas_centerY);
        make.height.mas_equalTo(20);
    }];
}
+ (UILabel *)initTitleLabWithText:(NSString *)text {
    UILabel *lab = [[UILabel alloc] init];
    lab = [[UILabel alloc] init];
    lab.textColor = [UIColor colorWithHexString:@"#999999"];
    lab.font = [UIFont systemFontOfSize:13];
    lab.text = text;
    return lab;
}
+ (UILabel *)initDetailTitle{
    UILabel *lab = [[UILabel alloc] init];
    lab = [[UILabel alloc] init];
    lab.textColor = [UIColor textBlackColor];
    lab.font = [UIFont systemFontOfSize:13];
    return lab;
}
- (UIImageView *)headImg {
    if (!_headImg) {
        _headImg = [[UIImageView alloc] init];
    }
    return _headImg;
}
- (UILabel *)pigNum{
    if (!_pigNum) {
        _pigNum = [[UILabel alloc] init];
        _pigNum.textColor = [UIColor colorWithHexString:@"#F1935F"];
        _pigNum.font = [UIFont systemFontOfSize:10];
        _pigNum.backgroundColor = [UIColor colorWithHexString:@"#FEF6EE"];
    }
    return _pigNum;
}
- (UILabel *)pigInfoTitle {
    if (!_pigInfoTitle) {
        _pigInfoTitle = [[UILabel alloc] init];
        _pigInfoTitle.textColor = [UIColor textBlackColor];
        _pigInfoTitle.font = [UIFont largerFont];
    }
    return _pigInfoTitle;
}
- (UIView *)pigInfoLine {
    if (!_pigInfoLine) {
        _pigInfoLine = [[UIView alloc] init];
        _pigInfoLine.backgroundColor = [UIColor colorWithHexString:@"#EAEAEA"];
    }
    return _pigInfoLine;
}
- (UILabel *)weightLab {
    if (!_weightLab) {
        _weightLab = [ReceivePigInfoView initTitleLabWithText:@"仔猪体重"];
    }
    return _weightLab;
}

- (UILabel *)birthdayLab {
    if (!_birthdayLab) {
        _birthdayLab = [ReceivePigInfoView initTitleLabWithText:@"出生日期"];
        
    }
    return _birthdayLab;
}
- (UILabel *)currentDaysLab {
    if (!_currentDaysLab) {
        _currentDaysLab = [ReceivePigInfoView initTitleLabWithText:@"当前日龄"];
        
    }
    return _currentDaysLab;
}
- (UILabel *)dateLab {
    if (!_dateLab) {
        _dateLab = [ReceivePigInfoView initTitleLabWithText:@"预出栏日"];
    }
    return _dateLab;
}
- (UILabel *)adoptedDateLab {
    if (!_adoptedDateLab) {
        _adoptedDateLab = [ReceivePigInfoView initTitleLabWithText:@"领养日期"];
    }
    return _adoptedDateLab;
}
- (UILabel *)arrearageMoney {
    if (!_arrearageMoney) {
        _arrearageMoney = [ReceivePigInfoView initTitleLabWithText:@"欠费金额"];
        
    }
    return _arrearageMoney;
}
- (UILabel *)weightDetailLab {
    if (!_weightDetailLab) {
        _weightDetailLab = [ReceivePigInfoView initDetailTitle];
    }
    return _weightDetailLab;
}
- (UILabel *)adoptedDateDetailLab {
    if (!_adoptedDateDetailLab) {
        _adoptedDateDetailLab = [ReceivePigInfoView initDetailTitle];
        
    }
    return _adoptedDateDetailLab;
}
- (UILabel *)birthdayDetailLab {
    if (!_birthdayDetailLab) {
        _birthdayDetailLab = [ReceivePigInfoView initDetailTitle];
        
    }
    return _birthdayDetailLab;
}
- (UILabel *)currentDaysDetailLab {
    if (!_currentDaysDetailLab) {
        _currentDaysDetailLab = [ReceivePigInfoView initDetailTitle];
        
    }
    return _currentDaysDetailLab;
}
- (UILabel *)dateDetailLab {
    if (!_dateDetailLab) {
        _dateDetailLab = [ReceivePigInfoView initDetailTitle];
    }
    return _dateDetailLab;
}

- (UILabel *)arrearageDetailMoney {
    if (!_arrearageDetailMoney) {
        _arrearageDetailMoney = [ReceivePigInfoView initDetailTitle];
    }
    return _arrearageDetailMoney;
}
- (UIView *)bottomLine {
    if (!_bottomLine) {
        _bottomLine = [[UIView alloc] init];
        _bottomLine.backgroundColor = [UIColor colorWithHexString:@"#000000" alpha:0.08];
    }
    return _bottomLine;
}
- (UILabel *)transferMoney {
    if (!_transferMoney) {
        _transferMoney = [ReceivePigInfoView initDetailTitle];
        _transferMoney.text = @"转让价格";
    }
    return _transferMoney;
}
- (UILabel *)transferDetailMoney {
    if (!_transferDetailMoney) {
        _transferDetailMoney = [[UILabel alloc] init];
        _transferDetailMoney.textColor = [UIColor colorWithHexString:@"#F25C62"];
        _transferDetailMoney.font = [UIFont smallFont];
    }
    return _transferDetailMoney;
}
@end
